﻿using Prism.Commands;
using Prism.Mvvm;
using RoboAssembleX.Application.ActionJbo;
using RoboAssembleX.Application.AddGlass1;
using RoboAssembleX.Application.AddNeedle2;
using RoboAssembleX.Application.Vision;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RoboAssembleX.ViewModels
{
    public class ViewAutoRunControlViewModel : BindableBase
    {
        private readonly AutoRunService autoRunService;
        public AutoRunModel AutoRunModel { get; }
        public DelegateCommand<string> ButtonCommand { get; private set; }
        public ViewAutoRunControlViewModel(AutoRunModel autoRunModel, AutoRunService autoRunService, VisionService visionService)
        {
            this.AutoRunModel = autoRunModel;
            this.autoRunService = autoRunService;
            ButtonCommand = new DelegateCommand<string>(ButtonMethod);
            Task.Run(async () =>
            {
                await Task.Delay(1000);
                visionService.InitVisionService();
            });
        }

        private void ButtonMethod(string menuName)
        {
            switch (menuName)
            {
                case "SwitchAutoRun":
                    autoRunService.SwitchAutoRun();
                    break;
            }
        }
    }
}
